﻿using Microsoft.AspNetCore.Http;

namespace VisionCloud.Domain.File.Model
{
    public class UserFile
    {
        public string FileName { get; set; }
        public long Length { get; set; }
        public string Extension { get; set; }
        public string FileType { get; set; }

        private IFormFile file;

        public IFormFile File
        {
            get { return file; }
            set
            {
                if (value != null)
                {
                    this.file = value;
                    this.FileType = this.file.ContentType;
                    this.Length = this.file.Length;
                    this.Extension = this.file.FileName.Substring(file.FileName.LastIndexOf('.'));
                    this.FileName = this.file.FileName;
                }
            }
        }
    }
}